package o;

import com.huawei.appgallery.game.impl.GameResource;
import com.huawei.hms.framework.network.restclient.dnkeeper.DNKeeperConfig;
import java.util.List;

public class clg {
    private static final Object ˋ = new Object();
    private static clg ˏ = null;
    public static final String ॱ = GameResource.class.getSimpleName();
    private cli ˊ = cli.ˊ();
    private cfu ˎ = this.ˊ.ʽ(ॱ);

    public static clg ˏ() {
        clg o_clg;
        synchronized (ˋ) {
            if (ˏ == null) {
                ˏ = new clg();
            }
            o_clg = ˏ;
        }
        return o_clg;
    }

    private clg() {
    }

    public void ˎ(GameResource gameResource) {
        if (this.ˎ.ˋ(GameResource.class, "packageName_=?", new String[]{gameResource.ॱ()}, null, null).isEmpty()) {
            this.ˎ.ˎ(gameResource);
            return;
        }
        this.ˎ.ॱ(gameResource, "packageName_=?", new String[]{gameResource.ॱ()});
    }

    public List<GameResource> ˊ() {
        return this.ˎ.ˋ(GameResource.class, null);
    }

    public GameResource ˏ(long j) {
        List ˋ = this.ˎ.ˋ(GameResource.class, "downloadId_=?", new String[]{String.valueOf(j)}, null, null);
        if (ˋ.isEmpty()) {
            return null;
        }
        return (GameResource) ˋ.get(0);
    }

    public GameResource ˊ(String str) {
        List ˋ = this.ˎ.ˋ(GameResource.class, "packageName_=?", new String[]{str}, null, null);
        if (ˋ.isEmpty()) {
            return null;
        }
        return (GameResource) ˋ.get(0);
    }

    public List<GameResource> ˋ() {
        return this.ˎ.ˋ(GameResource.class, "status_=?", new String[]{String.valueOf(1)}, null, null);
    }

    public void ˎ() {
        this.ˎ.ˋ(null, null);
    }

    public List<GameResource> ॱ() {
        String[] strArr = new String[]{String.valueOf(2), String.valueOf(System.currentTimeMillis() - DNKeeperConfig.SEVEN_DAYS)};
        return this.ˎ.ˋ(GameResource.class, "status_=? and finishTime_<?", strArr, null, null);
    }
}
